package org.eirudy.shareimage.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.eirudy.shareimage.api.aliyunai.model.CreateOutPaintingTaskResponse;
import org.eirudy.shareimage.model.dto.picture.*;
import org.eirudy.shareimage.model.dto.user.UserQueryRequest;
import org.eirudy.shareimage.model.entity.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import org.eirudy.shareimage.model.entity.User;
import org.eirudy.shareimage.model.vo.PictureVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author Eirudy
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2025-05-13 20:00:33
*/
public interface PictureService extends IService<Picture> {
    /**
     * 上传图片
     *
     * @param inputSource
     * @param pictureUploadRequest
     * @param loginUser
     * @return
     */
    PictureVO uploadPicture(Object inputSource,
                            PictureUploadRequest pictureUploadRequest,
                            User loginUser);

    /**
     *  通过查询要求获得对应的queryWrapper
     * @param pictureQueryRequest
     * @return QueryWrapper
     */
     public QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    /**
     *  获得简化后的图片
     * @param picture
     * @param request
     * @return
     */
    public PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    /**
     *  查询图片列表时，获得分页后的图片
     * @param picturePage
     * @param request
     * @return
     */
    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage,HttpServletRequest request);

    void validPicture(Picture picture);

    void doPictureReview(PictureReviewRequest picture, User loginuser);

    /**
     * 批量抓取图片，便于冷启动
     *
     * @param pictureUploadByBatchRequest
     * @param user
     */
    Integer uploadPictureByBatch(PictureUploadByBatchRequest pictureUploadByBatchRequest, User user);

    /**
     *  删除图片
     * @param oldpicture
     */
    void clearPicture(Picture oldpicture);


    /**
     * 校验用户空间权限，能否看见这张图片
     * @param loginuser
     * @param picture
     */
    void checkPictureAuth(User loginuser, Picture picture);

    /**
     * 删除图片
     * @param pictureId
     * @param loginUser
     */
    void deletePicture(Long pictureId, User loginUser);

    /**
     * 编辑图片
     */
    void editPicture(PictureEditRequest pictureEditRequest, User loginUser);

    /**
     * 根据图片颜色搜索某个空间内的图片
     *
     * @param spaceId
     * @param picColor
     * @param loginUser
     * @return
     */
    List<PictureVO> searchPictureByColor(Long spaceId, String picColor, User loginUser);


    void editPictureByBatch(PictureEditByBatchRequest pictureEditByBatchRequest, User loginUser);


    /**
     *  创建扩图任务
     */
    CreateOutPaintingTaskResponse createPictureOutPaintingTask(CreatePictureOutPaintingTaskRequest createPictureOutPaintingTaskRequest, User loginUser);

}
